<?php
include "sql.php";
if(empty($_POST['xuehao'])){

echo    '<div style="width: 200px;margin: 100px auto 0 auto">';
echo       '<form action="search.php" method="post">';

echo              '学号：<input type="text" name="xuehao"><br><br>';
echo              '<input type="submit" value="查询">';
      
echo        '</form>';

echo        '</div>';
exit;
}else{
    $xuehao= $_POST['xuehao'];
    $cha=$con->query("select * from userorder where xuehao='{$xuehao}' and mzhuangtai='1' order by id desc ");
    $res=[];
    $i=0;
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
  		<link rel="stylesheet" href="css/amazeui.min.css" />
		<link rel="stylesheet" href="css/admin.css" />
    <title>Document</title>
</head>
<body>
    
    <table class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
									<th class="table-set">订单号</th>
									<th class="table-set">学号</th>
									<th class="table-set">姓名</th>
									<th class="table-set">电话</th>
									<th class="table-set">地址</th>
									<th class="table-set">备注</th>
									<th class="table-set">信息</th>
									<th class="table-set">规格</th>
									<th class="table-set">金额</th>
									<th class="table-set">创建时间</th>
									<th class="table-set">状态</th>
									<th class="table-set">支付状态</th>
									<th class="table-set">完成时间</th>
								</tr>
							</thead>
							<tbody>
								<?php
								foreach($cha as $val){
									$res[$i]=$val;
							echo '<tr>';
							echo '<td>'.$res[$i]['orderhao'].'</td>';
							echo '<td>'.$res[$i]['xuehao'].'</td>';
							echo '<td>'.$res[$i]['username'].'</td>';
							echo '<td>'.$res[$i]['tel'].'</td>';
							echo '<td>'.$res[$i]['lou'].'号楼-'.$res[$i]['sushe'].'</td>';
							echo '<td>'.$res[$i]['beizhu'].'</td>';
							echo '<td>'.$res[$i]['xinxi'].'</td>';
							if($res[$i]['guige']==1){
								$guige="大件送达宿舍";
							}
							if($res[$i]['guige']==2){
								$guige="小件送达宿舍";
							}
							if($res[$i]['guige']==3){
								$guige="顺丰送达宿舍";
							}
							if($res[$i]['guige']==4){
								$guige="京东送达宿舍";
							}
							$time=date('Y-m-s h:i:s',$res[$i]['ctime']);
							echo '<td>'.$guige.'</td>';
							echo '<td>'.$res[$i]['money'].'</td>';
							echo '<td>'.$time.'</td>';
							echo '<td>'.$res[$i]['zhuangtai'].'</td>';
							echo '<td>已支付</td>';
							if($res[$i]['zhuangtai']==0){
								$otime="待取货";
							}if($res[$i]['zhuangtai']==1){
								$otime="待派货";
							}else{
								$otime=date('Y-m-d h:i:s',$res[$i]['otime']);
							}
							echo '<td>'.$otime.'</td>';

							echo '</tr>';
							$i++;
								}
								?>
								
								
							</tbody>
						</table>
</body>
</html>